package model

import (
	"gorm.io/gorm"
	__ "video-srv/basic/proto/rpc"
)

// Episode 剧集表
type Episode struct {
	gorm.Model
	VideoId      int    `gorm:"type:int" json:"videoId"`
	Title        string `gorm:"type:varchar(30)" json:"title"`     //视频标题
	VideoUrl     string `gorm:"type:varchar(255)" json:"videoUrl"` //视频链接
	Duration     int    `gorm:"type:int" json:"duration"`          //视频时长
	VideoOrder   int    `gorm:"type:int" json:"videoOrder"`        //视频排序
	LikeCount    int    `gorm:"type:int" json:"likeCount"`
	LookCount    int    `gorm:"type:int" json:"lookCount"`
	CommentCount int    `gorm:"type:int" json:"commentCount"`
	CollectCount int    `gorm:"type:int" json:"collectCount"`
	IsFree       int    `gorm:"type:int" json:"isFree"` //是否免费
}

func (e *Episode) GetEpisodeList(db *gorm.DB, videoId int) (episodeList []*__.EpisodeItem, err error) {
	err = db.Where("video_id = ?", videoId).Find(&episodeList).Error
	return
}
